package 网络编程.网络聊天室;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

public class counytryMyRun implements Runnable{
    Socket socket;
    public counytryMyRun(Socket socket){
        this.socket=socket;
    }
    @Override
    public void run() {
        //循环重复的接收服务器发送来的信息
        while (true) {
            try {
                //1.接收服务器转发的信息(接受信息)
                BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
                String s = br.readLine();
                System.out.println(s);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
